package main

import (
	"flag"
	"github.com/zeromicro/go-zero/core/conf"
	"shangke-device/app/rpc"
	"shangke-device/app/svcContent"
	"shangke-device/internal/yconf"
	"shangke-device/internal/yjsonrpc"
)

var f = flag.String("f", "config.yaml", "config file")

func main() {
	flag.Parse()
	var c yconf.Conf
	conf.MustLoad(*f, &c)
	svc := svcContent.NewSvc(&c)
	controller := rpc.NewController(svc)

	s, e := yjsonrpc.NewService(c.RpcConf)
	if e != nil {
		panic(e)
	}
	s.Start(controller)

	//spanCtx := trace.SpanContextFromContext(context.Background())
	//fmt.Println(spanCtx.TraceID().String())
	//fmt.Println(uuid.New().String())
	//log := ylog.NewYlog(c.LogConf)
	//for i := 0; i < 100000; i++ {
	//
	//	ctx := context.Background()
	//	ctx = log.WithContext(ctx)
	//	log1 := zerolog.Ctx(ctx)
	//	log1.Info().Msg(fmt.Sprintf("hello world %d", i))
	//}

	/*svcContent.Log.Info().Msg("hello world")

	_ = ymqtt.NewClient(context.Background(), c.MqttConf)

	t := time.NewTicker(30 * time.Second)
	for {
		select {
		case <-t.C:
			fmt.Println("等待中中")
		}
	}*/
}
